package FactoryPattern;

import Model.Book;

import java.util.Date;

public class FactoryPatternExample {
    public static void main(String[] args) {
        // 创建小说工厂并使用工厂创建小说对象
        BookFactory novelFactory = new NovelFactory();
        Book novel = novelFactory.createBook("To Kill a Mockingbird", "Harper Lee", "9780061120084", "Fiction", 281, 9.99, new Date(), 0);
        novel.displayInfo();

        // 创建科学类书籍工厂并使用工厂创建科学类书籍对象
        BookFactory scienceBookFactory = new ScienceBookFactory();
        Book scienceBook = scienceBookFactory.createBook("A Brief History of Time", "Stephen Hawking", "9780553380163", "Science", 256, 10.99, new Date(),0);
        scienceBook.displayInfo();

        // 创建艺术类书籍工厂并使用工厂创建艺术类书籍对象
        BookFactory artBookFactory = new ArtBookFactory();
        Book artBook = artBookFactory.createBook("The Starry Night", "Vincent van Gogh", "9783836557153", "Art", 160, 25.99, new Date(),0);
        artBook.displayInfo();
    }
}

